package com.slz3.business.module.goodsManagement.gooAttribute.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.goodsManagement.gooAttribute.domain.GooAttribute;
import com.slz3.business.module.goodsManagement.gooAttribute.domain.GooAttributeFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class GooAttributeTransactionalServiceImpl implements GooAttributeTransactionalService {

    @Override
    public GooAttribute modify(GooAttribute gooAttributeNew) {
        Repositorys.gooAttribute.test();
        Repositorys.gooAttribute.save(GooAttributeFactory.initBaseFields());
        System.err.println(1 / 0);
        gooAttributeNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.gooAttribute.saveAndFlush(gooAttributeNew);
    }

    @Override
    public List<GooAttribute> batchModify(List<GooAttribute> gooAttributeList) {
        return Repositorys.gooAttribute.saveAll(gooAttributeList);
    }
}
